<% if flash[:notice]  -%>
  <div class="sysmsg"><%= flash[:notice] -%></div>
  <% flash[:notice] = nil -%>
<% end -%>
<table id="columns">
  <tr>
    <!-- Main Messages -->
    <td id="main">
      <div id="content">
        <div id="bookmark-this">
          <p class="button">
            <a class="sharebtn" href="javascript:var%20d=document,w=window,f='http://i.dev:3000/share',l=d.location,e=encodeURIComponent,p='?u='+e%20(l.href)+'&t='+e(d.title)+'&d='+e(w.getSelection?w.getSelection().toString%20():d.getSelection?d.getSelection():d.selection.createRange().text);a=function(){if(!w.open%20(f+'r'+p,'sharer','toolbar=0,status=0,resizable=0,width=600,height=400'))%20l.href=f+'.new'+p};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}void(0)">
              <img alt="Favorite to Microblog" src="/images/share_button.gif" />
            </a>
          </p>
          <p class="desc">Drag this button to your browser's bookmark toolbar; When you find great websites, just click the bookmark and click "Favorite" button in the popup window. :) </p>
        </div>
        <div id="stream" class="message">
          <ol>
            <% if @favorites.length < 1 -%>
            <li span="unlight">
              <span class="content">Looks like <%= @user.display_name -%> haven't add any favorites to microblog. :) </span>
            </li>
            <% else -%>
              <% @favorites.each do |favorite| -%>
                <li class="unlight">
                  <span class="content"><%= h(favorite.title) + ": " + link_to((favorite.url.length > 25 ? (favorite.url.slice(0,24) + "...") : favorite.url), favorite.url) + " " + favorite.description -%></span>
                  <span class="stamp"><%= link_to("Posted about " + time_string(Time.now.to_i - favorite.favorite_at.to_i) + " ago", {:controller => :favorite, :action => "show", :id => favorite.id}, :class => "time") -%></span>
                  <span class="op">
                    <% if session[:user_name] == @user.name  -%>
                        <% session[:ori_uri] = request.request_uri -%>
                        <%= link_to("Delete", {:controller => :favorite, :action => "delete", :id => favorite.id}, :class => "delete", :confirm => "Do you really want to delete this favorite?") -%>
                    <% end -%>
                  </span>
                </li>
              <% end -%>
            <% end -%>
          </ol>
        </div>
        <% if @paged -%>
          <ul class="paginator">
            <% if @page > 1 -%>
              <li><%= link_to("&lt;&lt; Previous", :controller => :user, :action => "show", :id => @user.id, :page => (@page - 1)) -%></li>
            <% end -%>
            <% if @page < @page_count -%>
              <li><%= link_to("Next &gt;&gt;", :controller => :user, :action => "show", :id => @user.id, :page => (@page + 1)) -%></li>
            <% end -%>
          </ul>
        <% end -%>
      </div>
    </td>
    
    <!-- Sidebar -->
    <!-- All the following values will be replaced by varibles -->
    <td id="sidebar">
      <div id="user_top">
        <a href="/message"><%= image_tag(@user.avatar) -%>
        <h2><%= @user.display_name -%></h2></a>
      </div>
      <div id="user_infos">
        <ul class="vcard">
          <!-- All replaced by dynamic information-->
          <%= "<li>Sex: "+ h(@user.sex) + "</li>" if @user.sex.to_s.strip != "" -%>
          <%= "<li>City: <a href=\"@user.website\">"+ h(@user.website) + "</a></li>" if @user.website.to_s.strip != "" -%>
          <%= "<li>City: "+ h(@user.location) + "</li>" if @user.location.to_s.strip != "" -%>
          <%= "<li>Hometown: "+ h(@user.hometown) + "</li>" if @user.hometown.to_s.strip != "" -%>
          <%= "<li id=\"bio\">Description: " + h(@user.description) + "</li>" if @user.description.to_s.strip != "" -%>
        </ul>
      </div>
      <ul id="user_stats">
        <li>
          <a href="/friend/user/<%= @user.id -%>">
            <span class="count"><%= Follower.friend_count(@user.id) -%></span>
            <span class="label">Friends</span>
          </a>
        </li>
        <li>
          <a href="/friend/user/<%= @user.id -%>?opt=f">
            <span class="count"><%= Follower.follower_count(@user.id) -%></span>
            <span class="label">Followers</span>
          </a>
        </li>
        <li>
          <a href="/message/user/<%= @user.id -%>">
            <span class="count"><%= Message.message_count(@user.id) -%></span>
            <span class="label">Messages</span>
          </a>
        </li>
      </ul>
      <div class="stabs">
        <ul>
          <li class="Current">
            <a href="/home">
              <span class="label">Home</span>
            </a>
          </li>
          <li>
            <a href="/favorite/user/<%= @user.id -%>">
              <span class="label">Favorites</span>
            </a>
          </li>
        </ul>
      </div>
    </td>
  </tr>
</table>